.sidebar {
    &.sticky {
        @include respond(md) {
            position: sticky;
        }
    }
}

.left-sidebar {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    align-self: stretch;
    gap: var(--sidebar-element-separation);
    width: 100%;
    padding: 30px 0 15px 0;
    margin: 4px;
    max-width: relative;

    --sidebar-avatar-size: 128px;
    --sidebar-element-separation: 16px;
    --emoji-size: 36px;
    --emoji-font-size: 18px;
  
    .site-info {
        align-items: center;
    }

    @include respond(md) {
        width: auto;
        padding-top: var(--main-top-padding);
        padding-bottom: var(--main-top-padding);
        max-height: 100vh;
        margin: 8px;

        .site-info {
            align-items: unset;
        }
    }

    @include respond(2xl) {
        --sidebar-avatar-size: 168px;
        --sidebar-element-separation: 24px;
        margin: 16px;

        .site-info {
            align-items: unset;
        }
    }

    &.sticky {
        top: 0;
    }

    &.compact {
        --sidebar-avatar-size: 64px;
        --emoji-size: 30px;
        --emoji-font-size: 15px;

        header {
            @include respond(lg) {
                flex-direction: row;
            }

            .site-meta {
                gap: 5px;
            }

            .site-name {
                font-size: 1.4rem;

                @include respond(2xl) {
                    font-size: 1.75rem;
                }
            }

            .site-description {
                font-size: 1.6rem;
            }
        }
    }
}

.right-sidebar {
    width: 50%;
    display: none;
    flex-direction: column;
    gap: var(--widget-separation);

    &.sticky {
        top: 0;
    }

    @include respond(lg) {
        padding-top: var(--main-top-padding);
    }
}

.sidebar header {
    z-index: 1;
    transition: box-shadow 0.5s ease;
    display: flex;
    flex-direction: column;
    gap: var(--sidebar-element-separation);

    @include respond(md) {
        padding: 0;
    }

    .site-avatar {
        position: relative;
        margin: 0;
        width: var(--sidebar-avatar-size);
        height: var(--sidebar-avatar-size);
        flex-shrink: 0;

        .site-logo {
            width: 100%;
            height: 100%;
            border-radius: 100%;
            box-shadow: var(--shadow-l1);
            object-fit: cover;
        }

        .emoji {
            position: absolute;
            width: var(--emoji-size);
            height: var(--emoji-size);
            line-height: var(--emoji-size);
            border-radius: 100%;
            bottom: 0;
            right: 0;
            text-align: center;
            font-size: var(--emoji-font-size);
            background-color: var(--card-background);
            box-shadow: var(--shadow-l2);
        }
    }

    .site-icon {
        svg {
            width: 28px;
            height: 28px;
        }
    }

    .site-meta {
        display: flex;
        flex-direction: column;
        gap: 10px;
        justify-content: center;
    }

    .site-name {
        color: var(--accent-color);
        margin: 0;
        font-size: 1.6rem;

        @include respond(2xl) {
            font-size: 1.8rem;
        }
    }

    .site-description {
        color: var(--body-text-color);
        font-weight: normal;
        margin: 0;
        font-size: 1.4rem;

        @include respond(2xl) {
            font-size: 1.6rem;
        }
    }
}

.to-top {
    margin: 26px auto;
    display: none;

    .to-top-button {
        border: none;
        background: transparent;
        border: none;

        &:hover {
            background: var(--card-background);
            box-shadow: var(--shadow-l1);
            border-radius: var(--card-border-radius);
            transition: background 0.5s;
            -webkit-transition: background 0.5s;
        }

        svg {
            stroke: var(--body-text-color);
        }
    }

    @include respond(sm) {
        display: block;
    }
}

[data-scheme="dark"] {
    #dark-mode-toggle {
        color: var(--accent-color);
        font-weight: 700;

        .icon-tabler-toggle-left {
            display: none;
        }

        .icon-tabler-toggle-right {
            display: unset;
        }
    }
}

#dark-mode-toggle {
    margin-top: auto;
    color: var(--body-text-color);
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: var(--menu-icon-separation);

    .icon-tabler-toggle-right {
        display: none;
    }
}

#i18n-switch {
    color: var(--body-text-color);
    display: inline-flex;
    align-content: center;
    gap: var(--menu-icon-separation);

    select {
        border: 0;
        background-color: transparent;
        color: var(--body-text-color);

        option {
            color: var(--card-text-color-main);
            background-color: var(--card-background);
        }
    }
}
